<?php

/**
 * NeoEvento form.
 *
 * @package    neoTrainner
 * @subpackage form
 * @author     Your name here
 */
class NeoEventoForm extends BaseNeoEventoForm {

    public function configure() {
        unset(
                $this['created_at'], $this['updated_at']
        );


        $this->widgetSchema['fecha'] = new sfWidgetFormDateJQueryUI(
                        array("change_month" => true, "change_year" => true, "culture" => "es"));

        $this->widgetSchema['estado'] = new sfWidgetFormChoice(array(
                    'choices' => NeoEventoPeer::$estados,
                    'multiple' => false,
                    'default' => NeoEventoPeer::ESTADO_ACTIVO
                ));

        $this->widgetSchema['imagen'] = new sfWidgetFormInputFile();
        $this->widgetSchema->setHelp('imagen', 'Tamaño recomendado: 600 x 100 pixeles.');
        
        $this->validatorSchema['imagen'] = new sfValidatorFile(array(
                    'path' => sfConfig::get('sf_upload_dir') . '/eventos',
                    'required' => false,
                    'mime_types' => 'web_images'
        ));
        
        /*
         * tinyMCE: página de referencia http://wiki.moxiecode.com/index.php/TinyMCE:Control_reference#Default_buttons_available_in_the_advanced_theme
         */
        $tinyMCEConfig = "theme_advanced_buttons1: 'undo,redo,|,bold,italic,underline";
        $tinyMCEConfig.= ",|,strikethrough,justifyleft,justifycenter,justifyright,justifyfull";
        $tinyMCEConfig.= ",|,bullist,numlist,|'";
        $tinyMCEConfig.= ",theme_advanced_buttons2: 'forecolor,backcolor,|,hr,fontsizeselect,forecolor,backcolor,charmap";
        $tinyMCEConfig.= ",|,link,unlink,|'";
        $tinyMCEConfig.= ",theme_advanced_buttons3: ''";
        $tinyMCEConfig.= ",theme_advanced_resizing : false";
        $tinyMCEConfig.= ",theme_advanced_path : false";
        $tinyMCEConfig.= ",theme_advanced_statusbar_location : 'none'";
        
        $this->widgetSchema['descripcion'] = new sfWidgetFormTextareaTinyMCE(array(
                    'width' => 500,
                    'height' => 350,
                    'config' => $tinyMCEConfig
                ));
    }

}
